<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="__PUBLIC__/easyui/jquery.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/easyui/locale/easyui-lang-zh_CN.js"></script>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/easyui/themes/gray/easyui.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/easyui/themes/icon.css">
<link rel="stylesheet" href="__PUBLIC__/js/kindeditor/themes/default/default.css" />
<script src="__PUBLIC__/js/kindeditor/kindeditor-min.js"></script>
<script src="__PUBLIC__/js/kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/add-tab.js"></script>

<script type="text/javascript">
	$(function(){
		var timestamp = new Date().getTime();
		timestamp='Bills'+timestamp;
		$('#bills_num').val(timestamp);

		
		 /*提交流程/保存流程*/
    	$("#submitOrkeep a").click(function(){
    		var type=$(this).attr("id");
    		var data=new Array();//签批单数据数组
			data['document_title']=$("input[name='title']").val().trim();
			data['document_number']=new Date().getTime();
    		data['document_author']="{$Think.session.employe_id}";
    		data['document_proofreader']=$("#check_person_id").val();
    		data['document_des']=$("textarea[name='des']").val();
    		data['document_manner']=$("input[name='manner']:checked").val();
    		data['msg_tip']=$("#msg_tip").val();
    		data['msg_phone']=$("#msg_phone").val();
    		if(1==data['document_manner']){
				data['document_content']=editor.html();
        	}else{
				data['document_url']=u;
            }
			if("keep"==type){
				data['document_tag']='0';
			}else{
				data['document_tag']='1';
			}
			/*表单验证*/
			if(""==data['document_proofreader']){
				$.messager.alert('提示','未选择下一步任务执行人','error');
				return false;
			}
			if(""==data['document_title']){
				$.messager.alert('提示','文件标题为空','warning');
				return false;
			}
			if(null==data['document_manner']){
				$.messager.alert('提示','未选择编辑方式','warning');
				return false;
			}
			if(1==data['document_manner']){
				if(""==data['document_content']){
					$.messager.alert('提示','文件内容问空','warning');
					return false;
				}
			}else if(2==data['document_manner']){
				if(undefined==data['document_url']){
					$.messager.alert('提示','未上传文件','warning');
					return false;
				}
			}
			$.messager.progress({text:'正在提交，请稍等...'}); 
			$.post("__URL__/addDocument",{document_title:data['document_title'],document_number:data['document_number'],document_author:data['document_author'],document_proofreader:data['document_proofreader'],
				document_des:data['document_des'],document_manner:data['document_manner'],
				document_content:data['document_content'],document_url:data['document_url'],
				document_tag:data['document_tag'],msg_phone:data['msg_phone'],msg_tip:data['msg_tip']},function(r){
				if(0==r){
					$.messager.alert('提示','提交失败','warning');
				}else{
					$.messager.progress('close'); 
					$.messager.alert('提示','提交成功');
					window.location="__APP__/Process/processList";	
				}
			});
    	});
	});
	/*设置文本编辑器*/
	var editor;
	KindEditor.ready(function(K) {
		editor = K.create('textarea[name="content"]', {
			allowFileManager : true
		});
	});

	
</script>
<style type="text/css">
	.mainBody div,span{
		font-size: 14px;
		color: #444444;
		 margin: 0 auto;
		 padding: 0;
	}
	.mainBody tr td{
		font-size: 12px;
		color: #444444;
	}
	.mainBody th{
		border: 1px solid #D3D3D3;
		background-color: #f1f9fe;
		font-size: 12px;
		color: #444444;
	}
	.mainBody td{
		 border: 1px solid #D3D3D3;
	}
</style>
</head>
<body class="easyui-layout">
	<!-- 北部面板 -->
	<!-- 北部面板结束 -->
	<!-- 中部面板 -->
	<div class="mainBody" data-options="region:'center'">
		<table style="width:100%;border: 1px solid #D3D3D3; border-collapse: collapse;">
		<form id="file" method="post">
			<caption><h1>单据报销单</h1></caption>
			<tbody>
			<tr>
				<th>开始项目</th>
				<td><input type="text" name="title"/></td>
				<th>编号</th>
				<td>
					<input type="text" id="bills_num" name="bills_num"/>
				</td>
			</tr>
			<tr>
				<th>正件张数</th>
				<td>
					<input type="text" id="bills_count" name="bills_count"/>
				</td>
				<th>附件张数</th>
				<td>
					<input type="text" id="bills_accessory_count" name="bills_accessory_count"/>
				</td>
				<th>共报销金额</th>
				<td>
					<input type="text" id="bills_money" name="bills_money"/>
				</td>
			</tr>
			<tr>
				<th>备注</th>
				<td colspan="5">
					<textarea style="width:99%" name="bills_remark"></textarea>
				</td>
			</tr>
			
			</tbody>
		</form>
		</table>
<div style="padding-top: 10px;">
	<div style="text-align: center;">下一步任务设置</div>
	<div>
		<table style="width:100%;border: 1px solid #D3D3D3">
			<tbody>
				<tr style="border: 1px solid #D3D3D3;">
					
					<td style=" border: 1px solid #D3D3D3;width: 500px;">
						<span>
							任务执行人：
							<input value="" type="hidden">
							<input readonly="readonly" id="check_person" class="easyui-validatebox" name="check_person" onclick="doSearch()" type="text" data-options="required:true">
							<input type="hidden" id="check_person_id" name="check_person_id"/>
							<span style="margin-left: 15px;">
								<input id="msg_tip" name="msg_tip" checked="checked" type="checkbox" value="1">消息提醒
							</span>
							<span style="margin-left: 15px;">
								<input id="msg_phone" name="msg_phone" type="checkbox" value="0">手机提醒
							</span>
						</span>
					</td>
					<td style=" border: 1px solid #D3D3D3;">
						<span id="phone_num_span" style="display:none;float: left;">
							手机号码：<input type="text" id="phone_num" name="phone_num"/>
						</span>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</div>
<script type="text/javascript">
	$(function(){
		$('#msg_phone').change(function(){
			$('#phone_num_span').css('display','block');
			var temp =$('#msg_phone').val();
			if(temp==1){
				$('#msg_phone').val(0);
			}
			if(temp==0){
				$('#msg_phone').val(1);
			}
		})

		$('#msg_tip').change(function(){
			var temp =$('#msg_tip').val();
			if(temp==1){
				$('#msg_tip').val(0);
			}
			if(temp==0){
				$('#msg_tip').val(1);
			}
		})
	})
</script>

<div id="submitOrkeep" style="width:100%;text-align: center; margin-top:20px;">
	<a  href="#" class="easyui-linkbutton" id="submit">提交</a>
	<a  href="#" class="easyui-linkbutton" id="keep" style="margin-left:20px;">保存</a>
</div>


	</div>


	<!-- 中部面板结束 -->
	<include file="Common:checkPerson"/>
</body>
</html>